package com.boscloud.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.boscloud.pojo.*;
import com.boscloud.service.ProductionFeedBatchnoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin //允许跨域
@RestController

public class ProductionFeedBatchnoController {
    @Autowired
    private ProductionFeedBatchnoService ProductionFeedBatchnoService;
    @PostMapping("/ProductionFeedBatchNo")//生产投料获取工单
    public List<PostProductionFeed> getGetLocationCheckList(@RequestBody Map<String, Object> params) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID", "ITMS025");//接口ID
        return ProductionFeedBatchnoService.getPostProductionFeedList(params, headers);
    }
    @PostMapping("/ProductionFeedMat")//生产投料获取物料信息
    public List<PostProductionFeed> getGetLocationCheckMatList(@RequestBody Map<String, Object> params) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID", "ITMS026");//接口ID
        return ProductionFeedBatchnoService.getPostProductionFeedList(params, headers);
    }
    @PostMapping("/PostProductionFeed")//生产投料过账
    public List<PostGoodMvtResult> postProductionFeedList(@RequestBody PostProductionFeed PostProductionFeed) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS027");//接口ID
        Map<String, Object> params  = JSONObject.parseObject(JSON.toJSONString(PostProductionFeed));
        return ProductionFeedBatchnoService.postProductionFeedList(params,headers);
    }
}
